import { useEffect } from "react";
import NetInfo from "@react-native-community/netinfo";

export const useIPAddress = () => {
    useEffect(() => {
        const unsubscribe = NetInfo.addEventListener((state: any) => {
            console.log("实时 IP 地址:", state.details?.ipAddress);
        });
        return () => unsubscribe(); // 组件卸载时取消监听
    }, []);

    return null;
};

